package com.elinkway.infinitemovies.http.parser;

import com.elinkway.infinitemovies.bean.AppConfig;
import com.elinkway.infinitemovies.bean.HotAppConfig;

import org.json.JSONObject;

public class AppConfigParser extends LVideoMobileParser<AppConfig> {
    @Override
    public AppConfig parse(JSONObject data) throws Exception {
        AppConfig appConfig = null;
        if (null != data) {
            appConfig = new AppConfig();
            JSONObject hotAppObj = data.optJSONObject("hotapp");
            if (null != hotAppObj) {
                HotAppConfig hotAppConfig = new HotAppConfig();
                hotAppConfig.setDisplay(hotAppObj.optString("display"));
                hotAppConfig.setSource(hotAppObj.optString("source"));
                hotAppConfig.setUrl(hotAppObj.optString("url"));
                appConfig.setHotAppConfig(hotAppConfig);
            }
        }
        return appConfig;
    }
}
